
// 引入矢量图样式
require("../iconfont/iconfont.css");
require("../iconfont/font1/iconfont.css");

// 渲染tabbar函数
function renderTabbar( path) {
    let array=[{
        icon:'icon-shouye',
        homeA:'首页',
        path1:'./home.html',
    },{
        icon:'icon-24gl-heartPulse',
        homeA:'运动',
        path1:'./courseTrain.html',
    },{
        icon:'icon-quanzi',
        homeA:'圈子',
        path1:'./circle.html',
    },{
        icon:'icon-yonghu',
        homeA:'我的',
        path1:'./mine.html',
    }]

    let arr=array.map(v=>{
        // console.log(v.path1===`./${path}.html`);
        return  `
        <a href="${v.path1}" class="foot1 home ${v.path1===`./${path}.html`&&'active'} df fdc">
            <span class="iconfont ${v.icon}"></span>
            <span class="homeA ">${v.homeA}</span>
        </a>
            `;
    }).join('');
    let html = `${arr}`;

    // 创建一个footer
    let footer=document.createElement('footer');
    // 设置footer的class
    footer.className="foot df fn jcsb"
    // 给footer添加内容
    footer.innerHTML=html;
    // body吧footer添加到最后
    document.body.appendChild(footer);

}

// 导出tabbar渲染函数
module.exports = renderTabbar;
